package com.kafkacode.consumer;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.kafka.support.Acknowledgment;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class EventConsumer {
    @KafkaListener(topics = {"osTopic"}, groupId = "osGroup")
//    concurrency:消费者个数->启动三个线程。
    public void onEventA(ConsumerRecord<String, String> record, Acknowledgment ack) {
        System.out.println(Thread.currentThread().getId()+"-->消息消费，records = " + record);
        ack.acknowledge();
    }
}




